%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/conditions/archived-forum-inherited-messages.stream-7"
    Bucket0("Bucket 0 (root)<br /><br />1: PgSelectInlineApply[74]<br />ᐳ: 6, 9, 10, 29, 30, 84, 85, 86, 11, 13, 28, 32<br />2: PgSelectInlineApply[78]<br />3: PgSelect[8]<br />ᐳ: Access[79]<br />4: PgSelectRows[14]"):::bucket
    Bucket1("Bucket 1 (listItem)<br />Deps: 79, 11, 28, 32, 29, 30, 6<br /><br />ROOT __Item{1}ᐸ14ᐳ[15]"):::bucket
    Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 16, 79, 15, 11, 28, 32, 29, 30, 6<br /><br />ROOT PgSelectSingle{1}ᐸforumsᐳ[16]<br />1: <br />ᐳ: 17, 80, 81<br />2: Connection[24]"):::bucket
    Bucket3("Bucket 3 (nullableBoundary)<br />Deps: 16, 24, 81, 11, 28, 32, 29, 30, 6<br /><br />ROOT Connection{2}ᐸ81ᐳ[24]<br />1: ConnectionItems[33]<br />ᐳ: 19, 25, 52, 75<br />2: __CloneStream[38]"):::bucket
    Bucket6("Bucket 6 (defer)<br />Deps: 24, 11, 19, 25, 28, 32<br /><br />1: PgSelect[40]<br />ᐳ: PageInfo[39], Access[49], Access[50]<br />2: PgSelectRows[42]<br />ᐳ: 41, 43, 44"):::bucket
    Bucket7("Bucket 7 (listItem)<br />Deps: 11<br /><br />ROOT __Item{7}ᐸ38ᐳ[45]"):::bucket
    Bucket8("Bucket 8 (listItem)<br />Deps: 52, 75<br /><br />ROOT __Item{8}ᐸ33ᐳ[47]"):::bucket
    Bucket9("Bucket 9 (nullableBoundary)<br />Deps: 46, 11<br /><br />ROOT PgSelectSingle{7}ᐸmessagesᐳ[46]<br />1: <br />ᐳ: 51, 54<br />2: PgSelect[55]<br />3: PgSelectRows[60]<br />ᐳ: First[59], PgSelectSingle[61]"):::bucket
    Bucket10("Bucket 10 (nullableBoundary)<br />Deps: 47, 48, 75, 53<br /><br />ROOT Edge{8}[48]"):::bucket
    Bucket11("Bucket 11 (nullableBoundary)<br />Deps: 61<br /><br />ROOT PgSelectSingle{9}ᐸusersᐳ[61]"):::bucket
    Bucket12("Bucket 12 (nullableBoundary)<br />Deps: 75, 62<br /><br />ROOT PgSelectSingle{10}ᐸmessagesᐳ[62]<br />1: <br />ᐳ: List[76], Lambda[77]<br />2: PgSelectRows[70]<br />ᐳ: First[69], PgSelectSingle[71]"):::bucket
    Bucket13("Bucket 13 (nullableBoundary)<br />Deps: 71<br /><br />ROOT PgSelectSingle{12}ᐸusersᐳ[71]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2
    Bucket2 --> Bucket3
    Bucket3 --> Bucket6 & Bucket7 & Bucket8
    Bucket7 --> Bucket9
    Bucket8 --> Bucket10
    Bucket9 --> Bucket11
    Bucket10 --> Bucket12
    Bucket12 --> Bucket13

    %% plan dependencies
    PgSelect8[["PgSelect[8∈0] ➊<br />ᐸforumsᐳ<br />More deps:<br />- Object[11]"]]:::plan
    Lambda13{{"Lambda[13∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[ undefined, 'EXCLUSIVELY' ]ᐳ[85]"}}:::plan
    PgSelectInlineApply78["PgSelectInlineApply[78∈0] ➊<br />More deps:<br />- Lambda[28]"]:::plan
    Lambda13 & PgSelectInlineApply78 --> PgSelect8
    Object11{{"Object[11∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ<br />Dependents: 3"}}:::plan
    Access9{{"Access[9∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access10{{"Access[10∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access9 & Access10 --> Object11
    PgSelectInlineApply74["PgSelectInlineApply[74∈0] ➊"]:::plan
    PgSelectInlineApply74 --> PgSelectInlineApply78
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access9
    __Value2 --> Access10
    PgSelectRows14[["PgSelectRows[14∈0] ➊"]]:::plan
    PgSelect8 --> PgSelectRows14
    Lambda28{{"Lambda[28∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />Dependents: 2<br />More deps:<br />- Constantᐸ[HIDDEN]ᐳ[86]"}}:::plan
    Lambda32{{"Lambda[32∈0] ➊<br />ᐸresolveStreamDetailsᐳ<br />More deps:<br />- Constantᐸ[HIDDEN]ᐳ[84]"}}:::plan
    Access79{{"Access[79∈0] ➊<br />ᐸ8.m.subqueryDetailsFor20ᐳ"}}:::plan
    PgSelect8 --> Access79
    __Item15[/"__Item[15∈1]<br />ᐸ14ᐳ"\]:::itemplan
    PgSelectRows14 ==> __Item15
    PgSelectSingle16{{"PgSelectSingle[16∈1]<br />ᐸforumsᐳ"}}:::plan
    __Item15 --> PgSelectSingle16
    List80{{"List[80∈2]<br />ᐸ79,15ᐳ"}}:::plan
    Access79 & __Item15 --> List80
    PgClassExpression17{{"PgClassExpression[17∈2]<br />ᐸ__forums__.”name”ᐳ"}}:::plan
    PgSelectSingle16 --> PgClassExpression17
    Connection24[["Connection[24∈2]<br />ᐸ81ᐳ"]]:::plan
    Lambda81{{"Lambda[81∈2]<br />ᐸpgInlineViaSubqueryTransformᐳ"}}:::plan
    Lambda81 --> Connection24
    List80 --> Lambda81
    PgClassExpression19{{"PgClassExpression[19∈3]<br />ᐸ__forums__.”id”ᐳ"}}:::plan
    PgSelectSingle16 --> PgClassExpression19
    PgClassExpression25{{"PgClassExpression[25∈3]<br />ᐸ__forums__...chived_at”ᐳ"}}:::plan
    PgSelectSingle16 --> PgClassExpression25
    ConnectionItems33[["ConnectionItems[33∈3]"]]:::plan
    Connection24 --> ConnectionItems33
    __CloneStream38[["__CloneStream[38∈3@s]"]]:::plan
    ConnectionItems33 --> __CloneStream38
    Access52{{"Access[52∈3]<br />ᐸ81.cursorDetailsᐳ"}}:::plan
    Lambda81 --> Access52
    Access75{{"Access[75∈3]<br />ᐸ81.m.joinDetailsFor65ᐳ"}}:::plan
    Lambda81 --> Access75
    PgSelect40[["PgSelect[40∈6]<br />ᐸmessages(aggregate)ᐳ<br />More deps:<br />- Object[11]<br />- Lambda[28]"]]:::plan
    PgClassExpression19 & PgClassExpression25 & Lambda32 --> PgSelect40
    PageInfo39{{"PageInfo[39∈6]"}}:::plan
    Connection24 --> PageInfo39
    First41{{"First[41∈6]"}}:::plan
    PgSelectRows42[["PgSelectRows[42∈6]"]]:::plan
    PgSelectRows42 --> First41
    PgSelect40 --> PgSelectRows42
    PgSelectSingle43{{"PgSelectSingle[43∈6]<br />ᐸmessagesᐳ"}}:::plan
    First41 --> PgSelectSingle43
    PgClassExpression44{{"PgClassExpression[44∈6]<br />ᐸcount(*)ᐳ"}}:::plan
    PgSelectSingle43 --> PgClassExpression44
    Access49{{"Access[49∈6]<br />ᐸ24.hasNextPageᐳ"}}:::plan
    PageInfo39 o--o Access49
    Access50{{"Access[50∈6]<br />ᐸ24.hasPreviousPageᐳ"}}:::plan
    Access49 o--o Access50
    __Item45[/"__Item[45∈7]<br />ᐸ38ᐳ"\]:::itemplan
    __CloneStream38 ==> __Item45
    PgSelectSingle46{{"PgSelectSingle[46∈7]<br />ᐸmessagesᐳ"}}:::plan
    __Item45 --> PgSelectSingle46
    Edge48{{"Edge[48∈8]"}}:::plan
    __Item47[/"__Item[47∈8]<br />ᐸ33ᐳ"\]:::itemplan
    PgCursor53{{"PgCursor[53∈8]"}}:::plan
    __Item47 & PgCursor53 --> Edge48
    __Item47 & Access52 --> PgCursor53
    ConnectionItems33 ==> __Item47
    PgSelect55[["PgSelect[55∈9]<br />ᐸusersᐳ<br />More deps:<br />- Object[11]"]]:::plan
    PgClassExpression54{{"PgClassExpression[54∈9]<br />ᐸ__messages...author_id”ᐳ"}}:::plan
    PgClassExpression54 --> PgSelect55
    PgClassExpression51{{"PgClassExpression[51∈9]<br />ᐸ__messages__.”body”ᐳ"}}:::plan
    PgSelectSingle46 --> PgClassExpression51
    PgSelectSingle46 --> PgClassExpression54
    First59{{"First[59∈9]"}}:::plan
    PgSelectRows60[["PgSelectRows[60∈9]"]]:::plan
    PgSelectRows60 --> First59
    PgSelect55 --> PgSelectRows60
    PgSelectSingle61{{"PgSelectSingle[61∈9]<br />ᐸusersᐳ"}}:::plan
    First59 --> PgSelectSingle61
    PgSelectSingle62{{"PgSelectSingle[62∈10]<br />ᐸmessagesᐳ"}}:::plan
    __Item47 --> PgSelectSingle62
    PgClassExpression63{{"PgClassExpression[63∈11]<br />ᐸ__users__.”username”ᐳ"}}:::plan
    PgSelectSingle61 --> PgClassExpression63
    PgClassExpression72{{"PgClassExpression[72∈11]<br />ᐸ__users__....vatar_url”ᐳ"}}:::plan
    PgClassExpression63 o--o PgClassExpression72
    List76{{"List[76∈12]<br />ᐸ75,62ᐳ"}}:::plan
    Access75 & PgSelectSingle62 --> List76
    First69{{"First[69∈12]"}}:::plan
    PgSelectRows70[["PgSelectRows[70∈12]"]]:::plan
    PgSelectRows70 --> First69
    Lambda77{{"Lambda[77∈12]<br />ᐸpgInlineViaJoinTransformᐳ"}}:::plan
    Lambda77 --> PgSelectRows70
    PgSelectSingle71{{"PgSelectSingle[71∈12]<br />ᐸusersᐳ"}}:::plan
    First69 --> PgSelectSingle71
    List76 --> Lambda77
    PgClassExpression73{{"PgClassExpression[73∈13]<br />ᐸ__users__.”username”ᐳ"}}:::plan
    PgSelectSingle71 --> PgClassExpression73

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect8,Access9,Access10,Object11,Lambda13,PgSelectRows14,Lambda28,Lambda32,PgSelectInlineApply74,PgSelectInlineApply78,Access79 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,__Item15,PgSelectSingle16 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,PgClassExpression17,Connection24,List80,Lambda81 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,PgClassExpression19,PgClassExpression25,ConnectionItems33,__CloneStream38,Access52,Access75 bucket3
    classDef bucket6 stroke:#ff1493
    class Bucket6,PageInfo39,PgSelect40,First41,PgSelectRows42,PgSelectSingle43,PgClassExpression44,Access49,Access50 bucket6
    classDef bucket7 stroke:#808000
    class Bucket7,__Item45,PgSelectSingle46 bucket7
    classDef bucket8 stroke:#dda0dd
    class Bucket8,__Item47,Edge48,PgCursor53 bucket8
    classDef bucket9 stroke:#ff0000
    class Bucket9,PgClassExpression51,PgClassExpression54,PgSelect55,First59,PgSelectRows60,PgSelectSingle61 bucket9
    classDef bucket10 stroke:#ffff00
    class Bucket10,PgSelectSingle62 bucket10
    classDef bucket11 stroke:#00ffff
    class Bucket11,PgClassExpression63,PgClassExpression72 bucket11
    classDef bucket12 stroke:#4169e1
    class Bucket12,First69,PgSelectRows70,PgSelectSingle71,List76,Lambda77 bucket12
    classDef bucket13 stroke:#3cb371
    class Bucket13,PgClassExpression73 bucket13

